<?
$page_title="Timesheet Entry ";
$mindex=1;
?>
<?include("includes/header.php") ?>




<div class="bodycontent">
<script src="http://tablesorter.com/jquery.tablesorter.min.js"  type="text/javascript" ></script>
<form method="post" action="sheetpro.php">
<div class="frmrow">
	<span class="frmlabel">Date :</span>
	<input type="text" name="timesheet_date" id="timesheet_date" value="<?=date('d-m-Y',time())?>"/>
	<b>Hours :</b><input type="text" name="hours_spent" id="hours_spent" value="0" />
	 <br/>
</div>
<div class="frmrow">
	<span class="frmlabel">Tag :</span> 
	<input type="text" name="tag" value="standard" size="45" /> <span>(link,notes,standard,interview,meeting,discussion,kt)</span><br/>

</div>
<div class="frmrow">
<span class="frmlabel">Title :</span>
<input type="text" name="title" value="" size="45" /> <br/>
		
</div>
<div class="frmrow">
	<span class="frmlabel">Comments :</span>
	 <textarea rows="4" cols="44" name="comments" ></textarea>

</div>
<div class="fright">
	<input type="submit" class="button" value="Add Entry">
</div>
</form>
<div class="cleardiv"></div>

<hr/>

</div>



<div>

My Sheet for Today : 
<input type="radio" name="viewtype" value="1" id="rdtblView" checked="true"/><label for="rdtblView">Table View</label>
<input type="radio" name="viewtype" value="2" id="rdlstView"/><label for="rdlstView">List View</label>
<?
$userId=$_SESSION["user_id"];
$curdate=date('Y-m-d',time());
$sheetInfo=qry_data("select t.*,u.user_name from dev_user_timesheet t left join dev_user_mast u on t.user_id=u.user_id where t.timesheet_date='$curdate' and t.user_id=".$userId);

?>
<a name="views" href=""></a>
<div style="min-height:400px;overflow:auto;" id="dvTableView">
	<table id="timesheetList" class="tablesorter"> 
	<thead> 
	<tr> 
	    <th>S.No</th> 
	    <th>Name</th> 
	    <th>Sheet Date</th> 
	    <th>Added Date</th> 
	    <th>Tag</th> 
	   <th>Comments</th> 
   	   <th>Hours</th> 
	</tr> 
	</thead> 
	<tbody> 
	<? foreach($sheetInfo as $k=>$entry) {?>
	<tr> 
	<td><?=$k+1?></td>
	<td><?=$entry["user_name"]?></td> 
	<td><?=$entry["timesheet_date"]?></td> 
	<td><?=$entry["rec_created"]?></td> 
	<td><?=$entry["tag"]?></td> 
	<td><?=$entry["comments"]?></td> 
	<td><?=$entry["hours_spent"]?></td> 
	</tr> 
	<? } ?>
	
	</tbody> 
	</table> 
</div>

<div id="dvListView" style="min-height:400px;overflow:auto;display:none"  class="sheetlist">
	<? foreach($sheetInfo as $k=>$entry) {?>
	<div class="item">
	<div class="title">Title :<span><?=$entry["title"]?></span></div>
	<div class="cmt">Comments :<span><?=$entry["comments"]?></span></div>
	<div class="tag">Tag :<span><?=$entry["tag"]?></span></div>
	<div class="hour">Hours :<span><?=$entry["hours_spent"]?></span></div>
	
	<div class="entered">Entered On :<span><?=$entry["rec_created"]?></span></div>
	</div>
	
	<? } ?>
		
</div>


</div>


<script type="text/javascript">

$(document).ready(function(){ 
	
    	$( "#timesheet_date" ).datepicker({ dateFormat: 'dd-mm-yy' });
    	$("#ui-datepicker-div").hide();
        $("#timesheetList").tablesorter(); 
        
        $("#rdtblView").click(function(){
        	$("#dvListView").hide();
        	$("#dvTableView").hide(); 
        	
        	if(this.checked)
        		$("#dvTableView").show();
        	else
	        	$("#dvTableView").hide(); 
	        	
	        	location.href="#views";
	        
        })
        
        $("#rdlstView").click(function(){
     
        	$("#dvListView").hide();
        	$("#dvTableView").hide(); 
        	
               	if(this.checked)
        		$("#dvListView").show();
        	else
	        	$("#dvListView").hide(); 
	        	
        	   location.href="#views";
	        
        })
        
    } 
); 
  
	
</script>

<?include("includes/footer.php") ?>